#include "process.h"
void process1()
{
    char pro[101];
    memset(pro, 0, sizeof pro);
    for(int i  = 0;i < MAX_SIZE;i ++)
    {
        pro[i] = '=';
        printf("[%-100s]\r", pro);
        fflush(stdout);
        usleep(STIME);
    }
}
void process2(double rate)
{
    char str[5] = "+x";
    static int target = MAX_SIZE;
    static char pro[101] = {0};
    static int cnt = 0; 
    if(rate <= target && rate >= 0)
    {
        pro[(int)rate] = STYLE;
        pro[(int)rate + 1] = HEAD;
        printf("[%-100s][%.2lf%%][%c]\r", pro, rate, str[cnt++ % 2]);
        fflush(stdout);
    }
    else 
    {
        pro[target] = STYLE;
        printf("[%-100s][%.2lf%%][%c]\r", pro, rate , str[cnt++ % 2]);
        fflush(stdout);
    }
}
